﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CNKI.TPI.Web.Search.Model;
using System.Collections;
using CNKI.TPI.Web.Base;

namespace CNKI.TPI.Web.Search.IDAO
{
    public interface ICategoryDAO
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <returns></returns>
        IList<CLS> GetCategroyType(string DBName, int DBID);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <param name="sysID"></param>
        /// <returns></returns>
        CLS GetCategroyTypeBySysID(string DBName, int sysID);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <param name="categoryType"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        CLS_NODE GetCategroy(string DBName, int categoryType, string code);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <param name="categoryType"></param>
        /// <param name="syscode"></param>
        /// <returns></returns>
        IList<CLS_NODE> GetCategroy(string DBName, int categoryType, IList<string> syscode);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <param name="categoryType"></param>
        /// <returns></returns>
        IList<CLS_NODE> GetCategroyList(string DBName, int categoryType, int DBID);

        IList<CLS_NODE> GetCategroyAllList(string DBName, int categoryType, int DBID);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <param name="categoryType"></param>
        /// <param name="code"></param>
        /// <param name="grade"></param>
        /// <returns></returns>
        IList<CLS_NODE> GetChildrenCategroyList(string DBName, int categoryType, string code, int grade, int DBID);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<SYS_CMS_DATABASE_CLS> GetDatabaseCLSType();

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<SYS_CMS_DATABASE_CLS_NODE> GetDatabaseCLSNodeType(int clsID);

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IList<SYS_CMS_DATABASE_CLS_DB> GetDatabaseCLSDBType(int clsID, IEnumerable<string> clsCode);

        /// <summary>
        /// 根据code 获取数据库实例
        /// </summary>
        /// <param name="dbCode"></param>
        /// <param name="flage">1,过滤权限 0不过滤任何权限直接查询</param>
        /// <returns></returns>
        IList<SYS_CMS_DATABASE> GetDatabaseByCode(IEnumerable<string> databaseCode, int flage = 1, PermissionOption option = PermissionOption.FilteringPermissions);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dbID"></param>
        /// <returns></returns>
        IList<SYS_CMS_DATABASE> GetDatabaseByID(IEnumerable<int> dbID);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="databaseId"></param>
        /// <returns></returns>
        SYS_CMS_DATABASE GetDatabaseByID(int databaseId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="templateID"></param>
        /// <returns></returns>
        IList<SYS_CMS_DATABASE> GetDatabaseByTemplateID(IEnumerable<string> templateID);
        /// <summary>
        /// 删除导航分类
        /// </summary>
        /// <param name="sysid"></param>
        /// <param name="dbCode"></param>
        /// <returns></returns>
        bool DelCLS(int sysid, string dbCode);
        /// <summary>
        /// 删除分类
        /// </summary>
        /// <param name="sysid"></param>
        /// <param name="dbCode"></param>
        /// <returns></returns>
        bool DelCLS_Node(int sysid, string dbCode);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <returns></returns>
        bool InsertCategroyType(string dbCode, IList<CLS> categoryTypeList);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <returns></returns>
        bool InsertCategroyNode(string dbCode, IList<CLS_NODE> categoryTypeList);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <returns></returns>
        bool UpdateCategroyType(string dbCode, string sysid, Dictionary<string, object> categoryTypeList);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="DBName"></param>
        /// <returns></returns>
        bool UpdateCategroyNode(string dbCode, string sysid, Dictionary<string, object> categoryTypeList);

        IList<CLS> GetCategroyTypeAll(string DBName);

        CLS GetCLSInfo(string dbCode, string expression);

        /// <summary>
        /// 获得数据库信息---LZG添加
        /// </summary>
        /// <param name="dbcode">数据库code</param>
        /// <returns></returns>
        SYS_CMS_DATABASE GetDatabaseByCode(string dbcode);

        IList<CLS_NODE> GetCategroyListByCode(string DBName, int categoryType, string code);

        IList<CLS_NODE> GetCategroyListBySysCode(string DBName, int categoryType, string sysCode);

        IList<SYS_CMS_DATABASE> GetDatabaseBySearchType(SearchType searchType);

        IList<SYS_CMS_DATABASE> GetDatabaseBySearchType(IList<SearchType> searchType);
    }
}
